class ShieldController {
    private dlgShieldInvite : view.dlg.ShieldInvite;

    constructor() {
        Laya.timer.loop(Cfg.LoopTime, this, this.OnLoop);
    }

    ShowInvite(){
        if (!this.dlgShieldInvite) {
            this.dlgShieldInvite = new view.dlg.ShieldInvite();
        }
        this.dlgShieldInvite.ShowInvite();
    }

    OnLoop() : void {
        //检测狗的状态
        if (!ShieldModel.GetIsOpen()) {
            return;
        }
        //检测护盾是否到期
        if (ShieldModel.CheckStutus()) {
            Game.viewFarm.SetShield();
        }
    }

    SetShield() {
        ShieldModel.CheckStutus();
        Game.viewFarm.SetShield();
    }
}